Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): add http plugin #161

Merged

Conversation

OlivierAlbertini
Copy link
Member

@OlivierAlbertini OlivierAlbertini commented Aug 4, 2019

UPDATE:

  • Increase the coverage and add fixes related to tests, Since we don't have exporter feature yet, I created a ProxyTracer (only for tests) in order to get spans. Perhaps, once we get exporter feature, we could refactor in order to use it, that should be simpler overall

UPDATE 2:

  • use bind method

Closes #157
Signed-off-by: Olivier Albertini [email protected]

Thanks in advance for your feedback!

packages/opentelemetry-node-tracer/src/NodeTracer.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/package.json Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/package.json Outdated Show resolved Hide resolved
packages/opentelemetry-basic-tracer/src/BasicTracer.ts Outdated Show resolved Hide resolved
@vmarchaud
Copy link
Member

@OlivierAlbertini If you want some help don't hesitate to ping me on gitter (specially about the scopeManager use). I also speak french if you want

Copy link
Member

@rochdev rochdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be quite a few public methods. Is this intended? How is the plugin meant to be used?

packages/opentelemetry-basic-tracer/src/BasicTracer.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/types.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
@OlivierAlbertini
Copy link
Member Author

OlivierAlbertini commented Aug 5, 2019

There seem to be quite a few public methods. Is this intended? How is the plugin meant to be used?

Public methods are statics and is it like that in order to reuse those methods for other plugins http2 / https or for people that would like to make their own plugin.

I'm open to change to protected if you prefer.

I created a separate static class

packages/opentelemetry-plugin-http/package.json Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
packages/opentelemetry-plugin-http/src/http.ts Outdated Show resolved Hide resolved
@mayurkale22
Copy link
Member

I think you should add .DS_Store in .gitignore.

@mayurkale22
Copy link
Member

This is great start 💯

Added a few comments (first iteration). Please fix the build and rebase with master.

@OlivierAlbertini OlivierAlbertini force-pushed the feature/http-plugin branch 2 times, most recently from 0b98274 to 284aaeb Compare August 5, 2019 23:55
@mayurkale22
Copy link
Member

yarn run fix should fix most of the lint issues.

@OlivierAlbertini
Copy link
Member Author

OlivierAlbertini commented Aug 6, 2019

yarn run fix should fix most of the lint issues.

yes, I got an issue where one package was on the gts 1.0.0 version instead of 1.1.0...
There was a comma feature conflict.

EDIT: I don't know what going on with my mac but I have clearly an issue with gts...
yarn run fix doesn't do the same thing that it does on circlesci or docker (with the same version of gts/node).

I will check a bit more why the issue is on my machine but my workaround is to do:
docker run -v $(pwd):/usr/src/lib -w "/usr/src/lib/packages/opentelemetry-plugin-http" ae28164cf6da yarn run fix

@mayurkale22
Copy link
Member

mayurkale22 commented Aug 6, 2019

We are using nyc tool now, you should remove c8 dependency https://github.com/open-telemetry/opentelemetry-js/pull/161/files#diff-1a29b0926f59784792eb19ccaeffb380R48, looks like missed during rebase.

Also, I would suggest not to upgrade gts in this PR, to keep it small for code review. Feel free to open a separate PR for it.

@OlivierAlbertini OlivierAlbertini force-pushed the feature/http-plugin branch 4 times, most recently from bfbf65d to bec4e2c Compare August 6, 2019 03:47
@codecov-io
Copy link

codecov-io commented Aug 6, 2019

Codecov Report

Merging #161 into master will decrease coverage by 0.16%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
- Coverage   94.59%   94.42%   -0.17%     
==========================================
  Files          51       51              
  Lines        1906     1849      -57     
  Branches      128      128              
==========================================
- Hits         1803     1746      -57     
  Misses        103      103
Impacted Files Coverage Δ
...pe-async-hooks/test/AsyncHooksScopeManager.test.ts 100% <0%> (ø) ⬆️
...telemetry-scope-base/test/NoopScopeManager.test.ts 100% <0%> (ø) ⬆️

@OlivierAlbertini
Copy link
Member Author

Hi @rochdev

I added this issue #165

In order to avoid checking naming convention during PR review. Please feel free to comment and add your requirements.

Closes open-telemetry#157

Signed-off-by: Olivier Albertini <[email protected]>
Signed-off-by: Olivier Albertini <[email protected]>
test: increase coverage
fix: attributes requirements from the spec.

Signed-off-by: Olivier Albertini <[email protected]>
test: rename some tests
fix: copy/paste tests

Signed-off-by: Olivier Albertini <[email protected]>
fix parentSpanId instead of parentId from rebase
add workaround with got and node12+ (real http call)
improve args passed to function (url, options, cb)

Signed-off-by: Olivier Albertini <[email protected]>
Signed-off-by: Olivier Albertini <[email protected]>
fix: add Flarna recommendations
fix: tests
fix: OC bugs in OT only
test: add assertions
Allow options object as second argument

Signed-off-by: Olivier Albertini <[email protected]>
Signed-off-by: Olivier Albertini <[email protected]>
Signed-off-by: Olivier Albertini <[email protected]>
Signed-off-by: Olivier Albertini <[email protected]>
@OlivierAlbertini OlivierAlbertini force-pushed the feature/http-plugin branch 3 times, most recently from 7312f03 to 23f745b Compare August 30, 2019 20:35
refactor: make integration tests mandatory for ci only
remove duplicate tests
remove dead comments

Signed-off-by: Olivier Albertini <[email protected]>
@mayurkale22
Copy link
Member

I'm going to merge this PR. Let's address the remaining items and @todos after #232, #229 and #209. Thanks again for your contribution!

@mayurkale22 mayurkale22 merged commit 3f90bf9 into open-telemetry:master Aug 30, 2019
@OlivierAlbertini OlivierAlbertini deleted the feature/http-plugin branch August 30, 2019 22:32
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HTTP plugin
8 participants